#ifndef __OPENART_H_
#define __OPENART_H_

// 常量
#define OPENART_UART_LENGTH 5
#define UART_HEAD 0xb1
#define UART_TAIL 0xee
//---------RT1064->Openart串口指令集--------------//
//1.cmd_axis_verification	请求验证识别方框是否在中心
//2.cmd_find_apriltag		请求寻找二维码
//3.cmd_fine_number			请求识别数字
//4.cmd_find_animal_fruit	请求识别动物与水果
//------------------------------------------------//
#define CMD_AXIS_VERIFICATION 0x08 			
#define CMD_FIND_APRILTAG 0x04		
#define CMD_FIND_NUMBER 0x02
#define CMD_FIND_ANIMAL_FRUIT 0x01
//---------Openart->RT1064 串口指令集------------//
//1.cmd_Y_left             		三岔路口朝左转；
//2.cmd_Y_right            		三岔路口朝右转
//3.cmd_Animal_detected    		标靶识别结果为动物
//4.cmd_verification_fail	   （识别为水果前提下）坐标仍需校正
//5.cmd_verification_success	坐标验证结束，开始发射激光
//6.cmd_laser_stop				停止发射激光
//7.cmd_Apriltag_odd			二维码为奇数
//8.cmd_Apriltag_even			二维码为偶数
//9.cmd_Stop_Car				停车
//----------------------------------------------//
#define CMD_Y_LEFT 0x01					
#define CMD_Y_RIGHT 0x03				
#define CMD_ANIMAL_DETECTED 0x04
#define CMD_VERIFICATION_FAIL 0x10
#define CMD_VERIFICATION_SUCCESS 0x08
#define CMD_LASER_STOP 0x1c
#define CMD_APRILTAG_ODD 0x40
#define CMD_APRILTAG_EVEN 0x60
#define CMD_STOP_CAR 0xc0

// ------------------------------------------对外变量-------------------------------//
// 通讯
extern uint8 example_rx_buffer[OPENART_UART_LENGTH];
extern uint8 uart_data[OPENART_UART_LENGTH];
extern uint8 uart_last[OPENART_UART_LENGTH];
extern uint8 uart_cmd;
extern lpuart_transfer_t  example_receivexfer;
extern lpuart_handle_t  example_g_lpuartHandle;
// 云台参数
extern uint16 pan_mid_pos;
extern uint16 pan_right_pos;
extern uint16 pan_left_pos;

// 状态参数
extern uint8 flag_reaction;
extern uint8 flag_laser_shooting;
// ------------------------------------------函数-------------------------------//
extern void uart_callback(LPUART_Type *base, lpuart_handle_t *handle, status_t status, void *userData);
extern void OPENARTCmdDetection();
void Uart_Send();
#endif